#include "service_comet.hpp"
#include "sservice_comet.hpp"

namespace fasys{ namespace sservice{

sservice_comet::~sservice_comet()
{
  delete _service;
}

sservice_comet::sservice_comet()
  : _service(new service_comet)
{
}

void sservice_comet::initialize(isubscriptions* subscriptions, ipublisher* publisher)
{
  // _service->get_prototype().get_aspect().get<_open_subscription_>().subscriptions = subscriptions;
  // _service->get_prototype().get_aspect().get<_publish_>().publisher = publisher;
  _service->get_prototype().subscriptions = subscriptions;
  _service->get_prototype().publisher = publisher;
}


void sservice_comet::start(fas::mux::imux<>* mux, const config& conf)
{
  _service->stop();
  _service->set_mux(mux);
  _service->set_nonblock(true);
  _service->start("127.0.0.1", 8080);
}

void sservice_comet::stop()
{
  _service->stop();
}

}}
